package com.chzc.entity;

import java.util.Arrays;

/**
 * 自定义协议包，负责传输消息
 *
 * @author cv大魔王
 * @version 1.0
 * @date 2021/7/2 9:21
 */
public class DevilMessage {

    /**
     * 长度
     */
    private int len;

    /**
     * 消息内容
     */
    private byte[] content;


    /**
     * 消息id长度
     */
    private int messageIdLen;

    /**
     * 消息id
     */
    private byte[] messageId;


    /**
     * 队列名称
     */
    private byte[] queueName;

    /**
     * 队列名称长度
     */
    private int queueLen;

    /**
     * 消息状态
     * true代表生产者角色
     * false 代表消费之角色
     */
    private Integer status;

    /**
     * 是否属于心跳数据包
     */
    private boolean pingType;

    public byte[] getMessageId() {
        return messageId;
    }

    public void setMessageId(byte[] messageId) {
        this.messageId = messageId;
    }

    public int getMessageIdLen() {
        return messageIdLen;
    }

    public void setMessageIdLen(int messageIdLen) {
        this.messageIdLen = messageIdLen;
    }

    public boolean isPingType() {
        return pingType;
    }

    public void setPingType(boolean pingType) {
        this.pingType = pingType;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public int getQueueLen() {
        return queueLen;
    }

    public void setQueueLen(int queueLen) {
        this.queueLen = queueLen;
    }

    public byte[] getQueueName() {
        return queueName;
    }

    public void setQueueName(byte[] queueName) {
        this.queueName = queueName;
    }

    public int getLen() {
        return len;
    }

    public void setLen(int len) {
        this.len = len;
    }

    public byte[] getContent() {
        return content;
    }

    public void setContent(byte[] content) {
        this.content = content;
    }

    @Override
    public String toString() {
        return "DevilMessage{" +
                "len=" + len +
                ", content=" + Arrays.toString(content) +
                ", queueName=" + Arrays.toString(queueName) +
                ", queueLen=" + queueLen +
                '}';
    }

    public DevilMessage() {
    }

    public DevilMessage(int len, byte[] content, int messageIdLen, byte[] messageId, byte[] queueName, int queueLen, Integer status, boolean pingType) {
        this.len = len;
        this.content = content;
        this.messageIdLen = messageIdLen;
        this.messageId = messageId;
        this.queueName = queueName;
        this.queueLen = queueLen;
        this.status = status;
        this.pingType = pingType;
    }
}
